//
//  BCWalletExchangeDiplayView.m
//  GSBlockChain
//
//  Created by guoshikeji_a on 2019/1/21.
//  Copyright © 2019 guoshikeji. All rights reserved.
//

#import "BCWalletExchangeDiplayView.h"

@implementation BCWalletExchangeDiplayView


- (instancetype)init
{
    self = [super init];
    if (self) {
        [self initContentView];
        [self initLayoutSubviews];
    }
    return self;
}
- (void)initContentView {
    self.displayContentView = [UIView new];
    [self addSubview:self.displayContentView];
    //
    [self initSubviews];
}


- (void)initSubviews {
    self.inputTF = [QMUITextField new];
    self.inputTF.textInsets = UIEdgeInsetsZero;
    self.inputTF.textColor = [UIColor darkMainColor];
    self.inputTF.tintColor = self.inputTF.textColor;
    self.inputTF.font = [UIFont systemFontOfSize:24 weight:UIFontWeightMedium];
    [self.displayContentView addSubview:self.inputTF];
    self.inputTF.inputAccessoryView = [UIView new];
    //
    self.currencyLabel = [QMUILabel new];
    self.currencyLabel.textColor = [UIColor qmui_colorWithHexString:@"#999999"];
    self.currencyLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium];
    self.currencyLabel.contentEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 10);
    [self.displayContentView addSubview:self.currencyLabel];
    //
    self.bottomLine = [UIView new];
    self.bottomLine.backgroundColor = [UIColor separatorColor];
    [self.displayContentView addSubview:self.bottomLine];
}
- (void)initLayoutSubviews {
    [self.displayContentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.mas_equalTo(self);
        make.right.mas_equalTo(self).offset(0);
    }];
    //
    [self.currencyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.displayContentView);
        make.centerY.mas_equalTo(self.displayContentView);
    }];
    //
    [self.inputTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.displayContentView).offset(10.0);
        make.height.mas_equalTo(self.displayContentView);
        make.centerY.mas_equalTo(self.displayContentView);
        make.right.mas_equalTo(self.displayContentView).offset(0);
    }];
    //
    [self.bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.right.mas_equalTo(self);
        make.height.mas_equalTo(1.0);
    }];
}

- (void)setPlaceholder:(NSString *)placeholder {
    _placeholder = placeholder;
    //
    NSAttributedString *attri = [[NSAttributedString alloc] initWithString:placeholder attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16 weight:UIFontWeightMedium],NSForegroundColorAttributeName:[UIColor qmui_colorWithHexString:@"#D6D6D6"]}];
    self.inputTF.attributedPlaceholder = attri;
}


+ (CGFloat)defaultHeight {
    return 40.0f;
}

@end
